<?php
/**
 * SBForecastingRequestCampaignObject
 *
 * PHP version 5
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */

/**
 * Amazon Ads API - Sponsored Brands
 *
 * Use the Amazon Ads API for Sponsored Brands for campaign, ad group, keyword, negative keyword, drafts, Stores, landing pages, and Brands management operations. For more information about Sponsored Brands, see the [Sponsored Brands Support Center](https://advertising.amazon.com/help#GQFZA83P55P747BZ). For onboarding information, see the [account setup](https://advertising.amazon.com/API/docs/v3/guides/account_setup) topic.
 *
 * OpenAPI spec version: 3.0
 * 
 * Generated by:https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api.git
 * AmazonAdvertisingApi Codegen version: 3.0.51
 */
/**
 * NOTE: This class is auto generated by the AmazonAdvertisingApi code generator program.
 *https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 * Do not edit the class manually.
 */

namespace AmazonAdvertisingApi\Model;

use \ArrayAccess;
use \AmazonAdvertisingApi\ObjectSerializer;

/**
 * SBForecastingRequestCampaignObject Class Doc Comment
 *
 * @category Class
 * @description The campaign settings.
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */
class SBForecastingRequestCampaignObject implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $AmazonAdvertisingApiModelName = 'SBForecastingRequestCampaignObject';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiTypes = [
        'budget' => 'double',
        'budget_type' => 'string',
        'forecast_type' => 'string',
        'start_date' => '\DateTime',
        'end_date' => '\DateTime',
        'goal' => 'string',
        'ad_groups' => '\AmazonAdvertisingApi\Model\SBForecastingAdGroup[]'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiFormats = [
        'budget' => 'double',
        'budget_type' => null,
        'forecast_type' => null,
        'start_date' => 'date-time',
        'end_date' => 'date-time',
        'goal' => null,
        'ad_groups' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiTypes()
    {
        return self::$AmazonAdvertisingApiTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiFormats()
    {
        return self::$AmazonAdvertisingApiFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'budget' => 'budget',
        'budget_type' => 'budgetType',
        'forecast_type' => 'forecastType',
        'start_date' => 'startDate',
        'end_date' => 'endDate',
        'goal' => 'goal',
        'ad_groups' => 'adGroups'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'budget' => 'setBudget',
        'budget_type' => 'setBudgetType',
        'forecast_type' => 'setForecastType',
        'start_date' => 'setStartDate',
        'end_date' => 'setEndDate',
        'goal' => 'setGoal',
        'ad_groups' => 'setAdGroups'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'budget' => 'getBudget',
        'budget_type' => 'getBudgetType',
        'forecast_type' => 'getForecastType',
        'start_date' => 'getStartDate',
        'end_date' => 'getEndDate',
        'goal' => 'getGoal',
        'ad_groups' => 'getAdGroups'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$AmazonAdvertisingApiModelName;
    }



    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['budget'] = isset($data['budget']) ? $data['budget'] : null;
        $this->container['budget_type'] = isset($data['budget_type']) ? $data['budget_type'] : null;
        $this->container['forecast_type'] = isset($data['forecast_type']) ? $data['forecast_type'] : null;
        $this->container['start_date'] = isset($data['start_date']) ? $data['start_date'] : null;
        $this->container['end_date'] = isset($data['end_date']) ? $data['end_date'] : null;
        $this->container['goal'] = isset($data['goal']) ? $data['goal'] : null;
        $this->container['ad_groups'] = isset($data['ad_groups']) ? $data['ad_groups'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        if ($this->container['budget'] === null) {
            $invalidProperties[] = "'budget' can't be null";
        }
        if ($this->container['budget_type'] === null) {
            $invalidProperties[] = "'budget_type' can't be null";
        }
        if ($this->container['forecast_type'] === null) {
            $invalidProperties[] = "'forecast_type' can't be null";
        }
        if ($this->container['ad_groups'] === null) {
            $invalidProperties[] = "'ad_groups' can't be null";
        }
        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets budget
     *
     * @return double
     */
    public function getBudget()
    {
        return $this->container['budget'];
    }

    /**
     * Sets budget
     *
     * @param double $budget The amount of the budget.
     *
     * @return $this
     */
    public function setBudget($budget)
    {
        $this->container['budget'] = $budget;

        return $this;
    }

    /**
     * Gets budget_type
     *
     * @return string
     */
    public function getBudgetType()
    {
        return $this->container['budget_type'];
    }

    /**
     * Sets budget_type
     *
     * @param string $budget_type Budget can be set to DAILY or LIFETIME.   |BudgetType|Description| |-----------|-----------| |DAILY| The amount that you're willing to spend on this campaign each day. If the campaign spends less than your daily budget, the unspent amount can be used to increase your daily budget on the other days of the calendar month.| |LIFETIME| The total amount that you are willing to spend on this campaign.|
     *
     * @return $this
     */
    public function setBudgetType($budget_type)
    {
        $this->container['budget_type'] = $budget_type;

        return $this;
    }

    /**
     * Gets forecast_type
     *
     * @return string
     */
    public function getForecastType()
    {
        return $this->container['forecast_type'];
    }

    /**
     * Sets forecast_type
     *
     * @param string $forecast_type The forecast type. can be set to WEEKLY or MONTHLY.   **If have not set the forecastType during campaign creation then use WEEKLY as goal value.**
     *
     * @return $this
     */
    public function setForecastType($forecast_type)
    {
        $this->container['forecast_type'] = $forecast_type;

        return $this;
    }

    /**
     * Gets start_date
     *
     * @return \DateTime
     */
    public function getStartDate()
    {
        return $this->container['start_date'];
    }

    /**
     * Sets start_date
     *
     * @param \DateTime $start_date The YYYY-MM-DD start date for the campaign. If this field is not set to a value, the current date is used.
     *
     * @return $this
     */
    public function setStartDate($start_date)
    {
        $this->container['start_date'] = $start_date;

        return $this;
    }

    /**
     * Gets end_date
     *
     * @return \DateTime
     */
    public function getEndDate()
    {
        return $this->container['end_date'];
    }

    /**
     * Sets end_date
     *
     * @param \DateTime $end_date The YYYY-MM-DD end date for the campaign. Must be greater than the value for `startDate`. If not specified, the campaign has no end date and runs continuously.
     *
     * @return $this
     */
    public function setEndDate($end_date)
    {
        $this->container['end_date'] = $end_date;

        return $this;
    }

    /**
     * Gets goal
     *
     * @return string
     */
    public function getGoal()
    {
        return $this->container['goal'];
    }

    /**
     * Sets goal
     *
     * @param string $goal Goal will allow you to set goal type to help drive your campaign performance.   **If have not set the goal during campaign creation then use PAGE_VISIT as goal type.**    The goal type of the campaign. Initial launch only supports PAGE_VISIT.   BRAND_IMPRESSION_SHARE - This goal is a PREVIEW ONLY and cannot be set currently. It will allow you grown your brand impression share on top of search placement.   PAGE_VISIT - This goal drives traffic to your landing and detail pages through all placements.
     *
     * @return $this
     */
    public function setGoal($goal)
    {
        $this->container['goal'] = $goal;

        return $this;
    }

    /**
     * Gets ad_groups
     *
     * @return \AmazonAdvertisingApi\Model\SBForecastingAdGroup[]
     */
    public function getAdGroups()
    {
        return $this->container['ad_groups'];
    }

    /**
     * Sets ad_groups
     *
     * @param \AmazonAdvertisingApi\Model\SBForecastingAdGroup[] $ad_groups ad_groups
     *
     * @return $this
     */
    public function setAdGroups($ad_groups)
    {
        $this->container['ad_groups'] = $ad_groups;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}
